home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / util / libs / PalmLink.lha / PalmLink / developer / include / libraries / palmlink.h next >
Encoding:
C/C++ Source or Header  |  1998-09-10  |  10.7 KB  |  281 lines

  1. /*****************************************************************
  2. **                                                              **
  3. ** PalmLink Header File                                         **
  4. **                                                              **
  5. ******************************************************************
  6. **
  7. ** (C) 1998 Richard Körber -- all rights reserved
  8. **
  9. *****************************************************************/
  10.  
  11. #ifndef LIBRARIES_PALMLINK_H
  12. #define LIBRARIES_PALMLINK_H
  13.  
  14. #ifndef EXEC_TYPES_H
  15. #include <exec/types.h>
  16. #endif
  17. #ifndef UTILITY_TAGITEM_H
  18. #include <utility/tagitem.h>
  19. #endif
  20.  
  21.  
  22.  
  23. /*--------------------------------------------------------------**
  24. **    Miscellaneous
  25. */
  26. #define PALMLINK_NAME "palmlink.library"
  27.  
  28.  
  29.  
  30. /*--------------------------------------------------------------**
  31. **    Tags
  32. */
  33. #define PLTAG_BASE          (0x8FEA0000)        /* Base for all TagItems */
  34. #define PLTAG_ErrorPtr      (PLTAG_BASE + 0x00) /* Pointer to LONG for error code result */
  35. #define PLTAG_SerialDevice  (PLTAG_BASE + 0x01) /* Device name */
  36. #define PLTAG_SerialUnit    (PLTAG_BASE + 0x02) /* Device unit nr. */
  37. #define PLTAG_SerialMaxRate (PLTAG_BASE + 0x03) /* Maximum baud rate */
  38. #define PLTAG_SerialTimeout (PLTAG_BASE + 0x04) /* Timeout (seconds) */
  39. #define PLTAG_AbortMask     (PLTAG_BASE + 0x05) /* Signal mask for abortion, e.g. CTRL-C */
  40.  
  41.  
  42. /*--------------------------------------------------------------**
  43. **    Desktop Link Protocol
  44. */
  45. /* System Time */
  46. struct DLP_SysTime
  47. {
  48.   UWORD year;                           /* Year */
  49.   UBYTE month;                          /* Month */
  50.   UBYTE day;                            /* Day */
  51.   UBYTE hour;                           /* Hour */
  52.   UBYTE minute;                         /* Minute */
  53.   UBYTE second;                         /* Second */
  54.   UBYTE pad;                            /* (always set to 0) */
  55. };
  56.  
  57. /* RAM/ROM card info */
  58. struct DLP_StorageInfo
  59. {
  60.   UWORD  cardVersion;                   /* Version */
  61.   struct DLP_SysTime date;              /* Creation date */
  62.   ULONG  ROMSize;                       /* Size of ROM */
  63.   ULONG  RAMSize;                       /* Size of RAM */
  64.   ULONG  RAMFree;                       /* Free RAM */
  65.   char   name[128];                     /* Name of the card */
  66.   char   manuf[128];                    /* Manufacturer of the card */
  67.   UBYTE  cardNo;                        /* Card No. */
  68.   UBYTE  more;                          /* BOOL: more cards? */
  69. };
  70.  
  71. /* System Info */
  72. struct DLP_SysInfo
  73. {
  74.   ULONG romVer;                         /* ROM Version */
  75.   ULONG locale;                         /* Localizion code */
  76.   UBYTE name[128];                      /* System name */
  77. };
  78.  
  79. /* User Info */
  80. struct DLP_UserInfo
  81. {
  82.   ULONG userID;
  83.   ULONG viewerID;
  84.   ULONG lastSyncPC;
  85.   struct DLP_SysTime successfulSync;
  86.   struct DLP_SysTime lastSync;
  87.   char  userName[128];
  88.   char  password[128];
  89. };
  90.  
  91. /* Netsync Info */
  92. struct DLP_NetSyncInfo
  93. {
  94.   UWORD lanSync;
  95.   char hostName[256];
  96.   char hostAddress[40];
  97.   char hostSubnetMask[40];
  98. };
  99.  
  100. /* Database Info */
  101. struct DLP_DBInfo
  102. {
  103.   UBYTE more;                           /* BOOL: more databases? */
  104.   UBYTE excludes;                       /* Exclude flags, see below */
  105.   UWORD flags;                          /* Entry flags, see below */
  106.   ULONG type;                           /* Type ID */
  107.   ULONG creator;                        /* Creator ID */
  108.   UWORD version;                        /* Version */
  109.   ULONG modnum;                         /* Modification Number */
  110.   struct DLP_SysTime createDate;        /* Creation date */
  111.   struct DLP_SysTime modifyDate;        /* Last modification */
  112.   struct DLP_SysTime backupDate;        /* Last backup */
  113.   UWORD index;                          /* Index */
  114.   UBYTE name[34];                       /* Entry name */
  115. };
  116.  
  117. /* GetDBInfo flags */
  118. #define DLPGDBF_RAM           (0x80)    /* List RAM entries only */
  119. #define DLPGDBF_ROM           (0x40)    /* List ROM entries only */
  120.  
  121. /* DBInfo excludes */
  122. #define DLPDBIE_EXCLUDESYNC   (0x80)    /* Exclude from Sync */
  123.  
  124. /* DBInfo flags */
  125. #define DLPDBIF_RESOURCE      (0x0001)  /* DB Resource (not a record) */
  126. #define DLPDBIF_READONLY      (0x0002)  /* Read only */
  127. #define DLPDBIF_APPINFODIRTY  (0x0004)  /* AppInfo has been modified */
  128. #define DLPDBIF_BACKUP        (0x0008)  /* Generic backup */
  129. #define DLPDBIF_NEWER         (0x0010)  /* Newer may replace older in open DB */
  130. #define DLPDBIF_RESET         (0x0020)  /* Reset after installation */
  131. #define DLPDBIF_OPEN          (0x8000)  /* Currently opened */
  132.  
  133. /* DB Attribute */
  134. #define DLPDBAT_DELETED       (0x80)    /* Deleted */
  135. #define DLPDBAT_DIRTY         (0x40)    /* Changed since last sync */
  136. #define DLPDBAT_BUSY          (0x20)    /* Currently locked */
  137. #define DLPDBAT_SECRET        (0x10)    /* Private entry */
  138. #define DLPDBAT_ARCHIVE       (0x08)    /* To be archived on next sync */
  139.  
  140. /* DB Open flags */
  141. #define DLPDBOF_READ          (0x80)    /* Open for reading */
  142. #define DLPDBOF_WRITE         (0x40)    /* Open for writing */
  143. #define DLPDBOF_EXCLUSIVE     (0x20)    /* Do not share */
  144. #define DLPDBOF_SECRET        (0x10)    /* Private entry */
  145. #define DLPDBOF_READWRITE     (0xC0)
  146.  
  147.  
  148.  
  149. /*--------------------------------------------------------------**
  150. **    Connection Management Protocol
  151. */
  152.  
  153. /* CMP structure */
  154. struct PL_CMP
  155. {
  156.   UBYTE  type;                          /* CMP message type */
  157.   UBYTE  flags;                         /* Some flags */
  158.   UWORD  version;                       /* Version code */
  159.   WORD   reserved;                      /* 0 for now */
  160.   ULONG  baudrate;                      /* Wakeup: maximum rate */
  161.                                         /* Init: connection rate */
  162. };
  163.  
  164. /* CMP Types */
  165. #define PLCMP_WAKEUP      (1)           /* Wakeup */
  166. #define PLCMP_INIT        (2)           /* Init connection */
  167. #define PLCMP_ABORT       (3)           /* Abort connection */
  168.  
  169. /* CMP Flags */
  170. #define PLCMPF_CHANGEBAUD (0x80)        /* Init: change baud rate */
  171.  
  172.  
  173.  
  174. /*--------------------------------------------------------------**
  175. **    Packet Assembly Disassembly Protocol
  176. */
  177.  
  178. /* PADP Header structure */
  179. struct PL_PADP_Header
  180. {
  181.   UBYTE  type;                          /* Type of Packet */
  182.   UBYTE  flags;                         /* Flags */
  183.   UWORD  size;                          /* Size of data */
  184. };                                      /* Data follows here */
  185.  
  186. /* PADP Types */
  187. #define PLPADP_DATA       (0x01)        /* Plain Data */
  188. #define PLPADP_WAKE       (0x101)       /* Wakeup, used by CMP */
  189. #define PLPADP_ACK        (0x02)        /* Acknowledge */
  190. #define PLPADP_TICKLE     (0x04)        /* Tickle */
  191. #define PLPADP_ABORT      (0x08)        /* Abort (PalmOS 2.0 only) */
  192.  
  193. /* PADP Flags */
  194. #define PLPADPF_FIRST     (0x80)        /* First packet */
  195. #define PLPADPF_LAST      (0x40)        /* Last packet */
  196. #define PLPADPF_MEMERROR  (0x20)        /* Receiver has not enough memory */
  197.  
  198.  
  199.  
  200. /*--------------------------------------------------------------**
  201. **    Serial Link Protocol
  202. */
  203.  
  204. /* SLP Header structure */
  205. struct PL_SLP_Header
  206. {
  207.   UBYTE  signature[3];                  /* (will be set by palmlink.library) */
  208.   UBYTE  destSocket;                    /* Destination Socket ID */
  209.   UBYTE  srcSocket;                     /* Source Socket ID */
  210.   UBYTE  pckType;                       /* Packet Type */
  211.   UWORD  dataSize;                      /* (will be set by palmlink.library) */
  212.   UBYTE  transID;                       /* Current transaction ID */
  213.   UBYTE  checksum;                      /* (calculated by palmlink.library) */
  214. };
  215.  
  216. /* SLP Socket IDs */
  217. #define PLSLPSOCK_DEBUG (0)             /* Debugger */
  218. #define PLSLPSOCK_CON   (1)             /* Console */
  219. #define PLSLPSOCK_RUI   (2)             /* Remote User Interface */
  220. #define PLSLPSOCK_DLP   (3)             /* Desktop Link Protocol */
  221.  
  222. /* SLP Packet Types */
  223. #define PLSLPTYPE_RDCP  (0)             /* Remote Debugger / Console */
  224. #define PLSLPTYPE_PADP  (2)             /* Packet Assembler Disassembler */
  225. #define PLSLPTYPE_LOOP  (3)             /* Loopback */
  226.  
  227.  
  228.  
  229. /*--------------------------------------------------------------**
  230. **    Error Codes
  231. */
  232.  
  233. /* PalmLink errors */
  234. #define PLERR_OKAY              (0)     /* No error occured */
  235. #define PLERR_NOMEM             (-1)    /* Not enough memory */
  236. #define PLERR_NORESOURCE        (-2)    /* A resource is allocated */
  237. #define PLERR_SERIAL            (-3)    /* Some serial error */
  238. #define PLERR_TIMEOUT           (-4)    /* Connection timeout */
  239. #define PLERR_CHECKSUM          (-5)    /* Data checksum error */
  240. #define PLERR_REMOTENOMEM       (-6)    /* Remote has not enough memory */
  241. #define PLERR_BADPACKET         (-7)    /* Got an unexpected packet */
  242. #define PLERR_NOTCOMPATIBLE     (-8)    /* Connection not compatible */
  243. #define PLERR_BADBAUD           (-9)    /* No fitting Baud rate found */
  244.                                         /* If you should get this one, try */
  245.                                         /* to lower PLTAG_SerialMaxRate. */
  246.                                         /* 9600 should work in any case, */
  247.                                         /* except you have a very wierd */
  248.                                         /* multi serial board. */
  249. #define PLERR_DOSERROR          (-10)   /* DOS error, see IoErr() */
  250. #define PLERR_OS2REQUIRED       (-11)   /* PalmOS2.0 or higher is required */
  251.                                         /* to use this function */
  252. #define PLERR_TOOLARGE          (-12)   /* Data buffer is too large (>64KB) */
  253. #define PLERR_ABORTED           (-13)   /* Aborted by abortion signal */
  254.  
  255. /* DLP errors */
  256. #define PLERR_GENERAL           (1)     /* General system error */
  257. #define PLERR_ILLEGALFCT        (2)     /* Illegal function */
  258. #define PLERR_DLPNOMEM          (3)     /* Out of memory */
  259. #define PLERR_INVPARAM          (4)     /* Invalid parameter */
  260. #define PLERR_NOTFOUND          (5)     /* Not found */
  261. #define PLERR_NONEOPEN          (6)     /* None opened */
  262. #define PLERR_ALREADYOPEN       (7)     /* Already opened */
  263. #define PLERR_TOOMANYOPEN       (8)     /* Too many are opened */
  264. #define PLERR_ALREADYEXIST      (9)     /* Already exists */
  265. #define PLERR_CANTOPEN          (10)    /* Can't open */
  266. #define PLERR_RECDELETED        (11)    /* Record deleted */
  267. #define PLERR_RECBUSY           (12)    /* Record busy */
  268. #define PLERR_UNSUPPORTED       (13)    /* Operation not supported */
  269. #define PLERR_READONLY          (15)    /* Read only */
  270. #define PLERR_NOSPACE           (16)    /* Not enough space */
  271. #define PLERR_EXCEEDED          (17)    /* Limit exceeded */
  272. #define PLERR_CANCELLED         (18)    /* Sync cancelled */
  273. #define PLERR_BADARG            (19)    /* Bad argument wrapper */
  274. #define PLERR_ARGMISSING        (20)    /* Argument is missing */
  275. #define PLERR_ARGSIZE           (21)    /* Bad argument size */
  276.  
  277.  
  278. #endif
  279. /****************************************************************/
  280.  
  281.